package cn.idu.socket;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;

public class TestInetAddress {
    public static void main(String[] args) {
        try {
            InetAddress localHost = InetAddress.getLocalHost();
            System.out.println(Arrays.toString(localHost.getAddress()));
            System.out.println(localHost.getHostAddress());
            System.out.println(localHost.getHostName());
            System.out.println(localHost.getCanonicalHostName());
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
    }
}
